from api import log
from config import H0ST


class ApiRechange:

    def __init__(self,session):

        self.session = session

        self.__url_code=H0ST+"/common/public/verifycode1/{}"

        self.__url_rechange=H0ST+"/trust/trust/recharge"

    def api_img_code(self,random):

        log.info("正在调用充值接口验证码，请求方法：get 请求url:{}".format(self.__url_code.format(random)))
        return self.session.get(url=self.__url_code.format(random))


    def api_rechange(self):

        data={
            "paymentType":"chinapnr",
            "Trustamount": 10000,
            "formStr": "reForm",
            "valicode": "8888",
        }
        log.info("正在调用后台充值接口，请求方法：post 请求url:{} 请求参数：{}".format(self.__url_rechange,data))
        return self.session.post(url=self.__url_rechange,data=data)